import Vue from 'vue'

import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';
Sentry.init({
  dsn: 'https://3a616149309348c0ba886ab55a040798@sentry.io/2268995',
  integrations: [new Integrations.Vue({
    Vue,
    attachProps: true
  })],
});

import App from './App.vue'

import {
  encrypt,
  decrypt
} from './config'
// import WechatJSSDK from 'wechat-jssdk/dist/client.umd'
import {
  Lazyload,
  Swipe,
  SwipeItem,
  PullRefresh, //下拉刷新
  Toast,
  Icon,
  List,
  Popup,
  Overlay //遮罩层
} from 'vant';
import VueLazyload from 'vue-lazyload' //引入这个懒加载插件

import waterfall from 'vue-waterfall2'

import axios from 'axios';
import "vant/lib/index.css";
import './static/css/reset.scss';
import 'lib-flexible'
/* import Vconsole from 'vconsole'
const vConsole = new Vconsole()
Vue.use(vConsole) */
axios.get('/getSign').then(res => {
  let config = res;
  config.jsApiList = ['chooseImage', 'updateAppMessageShareData', 'onMenuShareTimeline', 'getLocation', 'checkJsApi', 'chooseWXPay']
  wx.config(config, true);
  // Vue.prototype.$wx = wx;
  // window.wx = wx;
})
Vue.config.errorHandler = function (err, vm, info) {
  throw err
  // handle error
  // `info` 是 Vue 特定的错误信息，比如错误所在的生命周期钩子
  // 只在 2.2.0+ 可用
}
/* Lazyload, {
  lazyComponent: true,
  loading: 'https://mars-kino.oss-cn-beijing.aliyuncs.com/salon/loading.svg'
} */
Vue.use(Swipe).use(SwipeItem).use(PullRefresh).use(Toast).use(Icon).use(List).use(Popup).use(Overlay).use(waterfall).use(VueLazyload, {
  preLoad: 1,
  observer: true,
  loading: 'https://mars-kino.oss-cn-beijing.aliyuncs.com/salon/loading.svg'
})
Vue.config.productionTip = false
Vue.prototype.$http = axios;
Vue.prototype.$encrypt = encrypt;
Vue.prototype.$decrypt = decrypt;
// 设置网页标题
Vue.directive('title', {
  inserted: function (el, binding) {
    document.title = el.dataset.title
  }
})
Vue.directive('focus', {
  // 当被绑定的元素插入到 DOM 中时……
  inserted: function (el, binding) {
    // 聚焦元素
    el.focus()
  }
})
new Vue({
  render: h => h(App),
}).$mount('#app')